import React from 'react'
import  store from '../../store/store'
import {getMovieListAction} from '../../store/action/movieaction'
import { useDispatch} from 'react-redux/es/hooks/useDispatch'
import { useSelector } from 'react-redux/es/hooks/useSelector'
export default function Movie() {
  const dispatch = useDispatch()
  const count = useSelector((state)=>{
    return state.count.count
  })
  const movieList = useSelector((state)=>{
    return state.movie.movieList
  })
  const getmovieListhandle = ()=>{
    dispatch(getMovieListAction())
  }
   return (
    <div>
      <hr />
      <h5>我能拿到count的数量：{count}</h5>
      <button onClick={getmovieListhandle}>获取电影列表</button>
      <h1>周末影院电影列表</h1>
      <ul>
       {movieList.map(item=>{
        return <li key={item.albumId}>{item.albumName}</li>
       })}
      </ul>
    </div>
  )
}
